package cn.znzz.cjm.util;

import cn.znzz.cjm.vo.UserInfo;
import com.alibaba.fastjson.JSON;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Component;

@Component
public class UserInfoUtil {
    @Autowired
    private RedisTemplate redisTemplate;

    public UserInfo getUserInfo(String name){
        String key =  "userinfo::" + name;
        Object object = redisTemplate.opsForValue().get(key);
        UserInfo userInfo = JSON.parseObject(JSON.toJSONString(object), UserInfo.class);
        return userInfo;
    }

}
